using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Workflow.Activities;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Windows.Forms;
using System.Runtime.CompilerServices;
using OpenComposite.Workflow.Properties;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Workflow.ComponentModel.Compiler;
using OpenComposite.Workflow.Interfaces;
using System.Drawing.Design;

namespace OpenComposite.Workflow
{
	[ActivityValidator(typeof(HorizontalSequenceActivityValidator))]
	[Designer(typeof(HorizontalSequenceDesigner))]
	[ActivityDesignerTheme(typeof(HorizontalSequenceTheme))]
	public class HorizontalSequenceActivity : SequenceActivity, ITextActivity
	{
		#region ITextActivity Members

		public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(HorizontalSequenceActivity));

		[Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]
		[DefaultValue("")]
		[Browsable(true)]
		public string Text
		{
			get { return GetValue(TextProperty) as string; }
			set { SetValue(TextProperty, value); }
		}

		DependencyProperty ITextActivity.GetTextProperty()
		{
			return TextProperty;
		}

		#endregion

		public static DependencyProperty AnalyticChanceProperty = DependencyProperty.Register("AnalyticChance", typeof(double), typeof(HorizontalSequenceActivity), new PropertyMetadata(100.0));

		[Browsable(false)]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
		[DefaultValue((double)100.0)]
		public double AnalyticChance
		{
			get { return (double)GetValue(AnalyticChanceProperty); }
			set { SetValue(AnalyticChanceProperty, value); }
		}

		protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
		{
			if ( this.EnabledActivities.Count == 0 ) return ActivityExecutionStatus.Closed;
			HorizontalWorkflowActivity root = WorkflowHelpers.GetRootActivity(this) as HorizontalWorkflowActivity;
			if ( root.UserData[Resources.sJumpData] != null ) {
				List<string> path = root.UserData[Resources.sJumpData] as List<string>;
				Activity act = GetActivityByName(path[0]);
				act.Closed += ContinueAt;
				executionContext.ExecuteActivity(act);
				path.RemoveAt(0);
				if ( path.Count == 0 )
					root.UserData.Remove(Resources.sJumpData);
			} else {
				Activity child = this.EnabledActivities[0];
				if ( child is JumpSplitActivity ) {
					/* DEBUG */
					//root.WhileConnectors.Clear();
					//root.WhileConnectors.Add(new FreeLoopConnector("whileSplit1", "writeLine11"));
					/* DEBUG */

					try {
						JumpSplitActivity split = child as JumpSplitActivity;
						if ( split.Condition.Evaluate(split, executionContext) ) {
							FreeConnector conn = getConnectedRoute(root, split);

							Activity target = GetActivityByName(conn.End);

							if ( target.Parent == executionContext.Activity ) {
								try {
									if ( target.ExecutionStatus == ActivityExecutionStatus.Initialized ) {
										target.Closed += ContinueAt;
										executionContext.ExecuteActivity(target);
									} else {
										ExecuteInNewContext(executionContext, target);
									}
								} catch ( Exception ex ) {
									EventLog.WriteEntry("HorizontalSequence.cs", ex.ToString());
								}
								return ActivityExecutionStatus.Executing;
							} else {
								List<string> path = WorkflowHelpers.GetActivityHierarchy(target);
								root.UserData[Resources.sJumpData] = path;
								return ActivityExecutionStatus.Closed;
							}

						}
						if ( child.ExecutionStatus == ActivityExecutionStatus.Initialized ) {
							child.Closed += ContinueAt;
							executionContext.ExecuteActivity(child);
						} else {
							ExecuteInNewContext(executionContext, child);
						}
					} catch ( Exception ex ) {
						EventLog.WriteEntry("HorizontalSequence.cs", ex.ToString());
					}
				} else {
					if ( child.ExecutionStatus == ActivityExecutionStatus.Initialized ) {
						child.Closed += ContinueAt;
						executionContext.ExecuteActivity(child);
					} else {
						ExecuteInNewContext(executionContext, child);
					}
				}
			}

			return ActivityExecutionStatus.Executing;

		}

		private FreeConnector getConnectedRoute(HorizontalWorkflowActivity root, JumpSplitActivity split)
		{
			return root.WhileConnectors.Find(delegate(FreeConnector conn)
			{
				if ( conn.Start == split.QualifiedName )
					return true;
				else
					return false;
			});
		}

		private void ExecuteInNewContext(ActivityExecutionContext context, Activity target)
		{
			ExecuteInNewContext(context, target, true);
		}

		private void ExecuteInNewContext(ActivityExecutionContext context, Activity target, bool continueExecution)
		{
			ActivityExecutionContext newContext = context.ExecutionContextManager.CreateExecutionContext(target);
			if ( continueExecution ) {
				newContext.Activity.Closed += ContinueAt;
			}
			try {
				newContext.ExecuteActivity(newContext.Activity);
			} catch ( Exception ex ) {
				MessageBox.Show("Error in ExecuteInNewContext" + Environment.NewLine + Environment.NewLine + ex.ToString());
			}
		}

		void ContinueAt(object sender, ActivityExecutionStatusChangedEventArgs e)
		{
			e.Activity.Closed -= ContinueAt;

			HorizontalWorkflowActivity root = (HorizontalWorkflowActivity)WorkflowHelpers.GetRootActivity(this);
			ActivityExecutionContext context = sender as ActivityExecutionContext;

			if ( root.UserData[Resources.sJumpData] != null ) {
				List<string> path = root.UserData[Resources.sJumpData] as List<string>;
				Activity act = GetActivityByName(path[0]);
				if ( context.Activity is HorizontalWorkflowActivity ) {
					if ( act.ExecutionStatus == ActivityExecutionStatus.Initialized ) {
						act.Closed += ContinueAt;
						context.ExecuteActivity(act);
					} else {
						ExecuteInNewContext(context, act);
					}
					path.RemoveAt(0);
					if ( path.Count == 0 )
						root.UserData.Remove(Resources.sJumpData);
				} else {
					if ( !( (CompositeActivity)context.Activity ).Activities.Contains(act) ) {
						WorkflowHelpers.CompleteCloseContext(context);
					}
				}
			} else {
				if ( this.ExecutionStatus == ActivityExecutionStatus.Executing ) {
					int index = this.EnabledActivities.IndexOf(GetActivityByName(e.Activity.QualifiedName));

					if ( index == this.EnabledActivities.Count - 1 ) {
						WorkflowHelpers.CompleteCloseContext(context);
					} else {
						Activity child = this.EnabledActivities[index + 1];

						if ( child is JumpSplitActivity ) {
							/* DEBUG */
							//root.WhileConnectors.Clear();
							//root.WhileConnectors.Add(new FreeLoopConnector("whileSplit1", "writeLine11"));
							/* DEBUG */

							JumpSplitActivity split = child as JumpSplitActivity;
							if ( split.Condition.Evaluate(split, context) ) {
								FreeConnector conn = getConnectedRoute(root, split);

								Activity target = GetActivityByName(conn.End);

								if ( target.Parent == context.Activity ) {
									if ( target.ExecutionStatus == ActivityExecutionStatus.Initialized ) {
										target.Closed += ContinueAt;
										context.ExecuteActivity(target);
									} else {
										ExecuteInNewContext(context, target);
									}
									return;
								} else {
									List<string> path = WorkflowHelpers.GetActivityHierarchy(target);
									root.UserData[Resources.sJumpData] = path;
									context.CloseActivity();
									return;
								}

							}
							if ( child.ExecutionStatus == ActivityExecutionStatus.Initialized ) {
								child.Closed += ContinueAt;
								context.ExecuteActivity(child);
							} else {
								ExecuteInNewContext(context, child);
							}
						} else {
							if ( child.ExecutionStatus == ActivityExecutionStatus.Initialized ) {
								child.Closed += ContinueAt;
								context.ExecuteActivity(child);
							} else {
								ExecuteInNewContext(context, child);
							}
						}
					}
				} else if ( this.ExecutionStatus == ActivityExecutionStatus.Canceling ) {
					WorkflowHelpers.SecureCloseContext(context);
				}
			}
		}

		protected override ActivityExecutionStatus HandleFault(ActivityExecutionContext executionContext, Exception exception)
		{
			Activity faultHandler = WorkflowHelpers.GetAlternateFlowActivity(Activities, typeof(HorizontalFaultHandlersActivity));
			if ( faultHandler != null ) {
				if ( faultHandler.ExecutionStatus == ActivityExecutionStatus.Initialized ) {
					executionContext.ExecuteActivity(faultHandler);
				} else {
					ExecuteInNewContext(executionContext, faultHandler, false);
				}
				return ActivityExecutionStatus.Executing;
			}
			return base.HandleFault(executionContext, exception);
		}

		protected override ActivityExecutionStatus Cancel(ActivityExecutionContext executionContext)
		{
			Activity cancellationHandler = WorkflowHelpers.GetAlternateFlowActivity(Activities, typeof(HorizontalCancellationHandlerActivity));
			if ( cancellationHandler != null ) {
				if ( cancellationHandler.ExecutionStatus == ActivityExecutionStatus.Initialized ) {
					executionContext.ExecuteActivity(cancellationHandler);
				} else {
					ExecuteInNewContext(executionContext, cancellationHandler, false);
				}
			}
			return base.Cancel(executionContext);
		}

		public new ReadOnlyCollection<Activity> EnabledActivities
		{
			get
			{
				List<Activity> list = new List<Activity>();
				foreach ( Activity activity in base.EnabledActivities ) {
					if ( activity.Enabled && !WorkflowHelpers.IsFrameworkActivity(activity) ) {
						list.Add(activity);
					}
				}
				return list.AsReadOnly();
			}
		}
	}

	public class HorizontalSequenceDesigner : SequentialActivityDesigner
	{
		private const int _connectorLength = 30;
		private bool _isDragging = false;
		private Point _dragPosition = new Point();
		private readonly Size _minimumSize = new Size(100, 50);
		List<Point> _innerConnections = new List<Point>();
		Point[] connector;

		protected override bool CanConnect(ConnectionPoint source, ConnectionPoint target)
		{
			return true;//base.CanConnect(source, target);
		}

		protected virtual Pen ConnectorPen
		{
			get { return new Pen(Color.Black); }
		}

		protected virtual bool ShowFirstConnector
		{
			get { return true; }
		}

		protected virtual bool ShowLastConnector
		{
			get { return false; }
		}

		/// <summary>
		/// Draws the visual representation of activity at design time.
		/// </summary>
		/// <param name="e">The <see cref="T:System.Workflow.ComponentModel.Design.ActivityDesignerPaintEventArgs"/> that contains the drawing arguments.</param>
		protected override void OnPaint(ActivityDesignerPaintEventArgs e)
		{
			if ( !this.IsVisible )
				return;
			//base.OnPaint(e);
			if ( this == ActiveView.AssociatedDesigner ) {
				//e.Graphics.DrawRectangle(pen, Bounds);

				base.PaintContainedDesigners(e);

				// Draw Connectors
				List<Point> points = new List<Point>();
				points.AddRange(GetInnerConnections(DesignerEdges.Left | DesignerEdges.Right));
				for ( int i = 0; i < points.Count; i += 2 ) {
					if ( !ShowFirstConnector && i == 0 ) continue;
					connector = new Point[] { points[i], points[i + 1] };
					if ( e.Graphics.IsVisible(connector[0]) ||
						e.Graphics.IsVisible(connector[1]) ||
						( connector.Length == 2 &&
						 connector[0].X < e.Graphics.ClipBounds.X &&
						 connector[1].X > e.Graphics.ClipBounds.X ) )
						base.DrawConnectors(e.Graphics,
							ConnectorPen,
							connector,
							LineAnchor.None, ( i == points.Count - 2 ) ? EndLineAnchor : AlternateEndLineAnchor);
				}

				// draw dropindicators
				if ( _isDragging ) {
					Rectangle[] targets = GetDropTargets(new Point(Location.X + 5, Location.Y + 5));
					////MessageBox.Show(_dragPosition.ToString());
					//MessageBox.Show(targets[CurrentDropTarget].ToString() + Environment.NewLine +
					//    _dragPosition.ToString());
					points.Clear();
					points.AddRange(GetInnerConnections(DesignerEdges.Right));
					int x, y;
					for ( int i = ShowFirstDropIndicator ? 0 : 1; i < targets.Length; i++ ) {
						if ( !targets[i].Contains(_dragPosition) ) {
							if ( e.Graphics.IsVisible(points[i]) ) {
								//int x = points[i].X + (_connectorLength / 2) - (Resources.Add.Width / 2);
								//int y = (points[i].Y - Resources.Add.Height / 2);
								x = targets[i].X + ( targets[i].Width / 2 ) - ( Resources.smalladd.Width / 2 );
								y = points[i].Y - ( Resources.smalladd.Height / 2 );
								e.Graphics.DrawImageUnscaled(Resources.smalladd, new Point(x, y));
							}
						}
					}
				} else if ( ContainedDesigners.Count == 0 ) {
					if ( !UseOneLineDropIndicatorString ) {
						e.Graphics.DrawString(string.Format("Drop Capabilities {0}{0}{1,8}here", Environment.NewLine, " "),
							e.DesignerTheme.Font,
							e.DesignerTheme.ForegroundBrush,
							(PointF)new Point(Bounds.X + ( Bounds.Width / 2 ) - 40, Bounds.Y + ( Bounds.Height / 2 ) - 20));
					} else {
						string text = "Drop Capabilities here";
						SizeF size = e.Graphics.MeasureString(text, e.DesignerTheme.Font);
						e.Graphics.DrawString(text,
							e.DesignerTheme.Font,
							e.DesignerTheme.ForegroundBrush,
							new PointF(Bounds.X + ( Bounds.Width / 2 ) - size.Width / 2, Bounds.Y + ( Bounds.Height / 2 ) + 5));
					}
				}
				// Debug Rectangles
				// drop targets
				//e.Graphics.DrawRectangles(pen, GetDropTargets(Bounds.Location));

				// connection points
				//foreach (Point point in points) {
				//    point.Offset(-5, -5);
				//    e.Graphics.DrawRectangle(pen, new Rectangle(point, new Size(10, 10)));
				//}
			}
		}

		protected virtual bool UseOneLineDropIndicatorString
		{
			get { return true; }
		}

		//private void DrawConnectors(Graphics graphics, Pen pen, Point[] connector, LineAnchor lineAnchor, LineAnchor lineAnchor_5)
		//{
		//    for (int i = 0; i < connector.Length; i+=2) {
		//        graphics.DrawLine(pen, connector[i], connector[i + 1]);
		//    }
		//}

		protected override Rectangle[] GetDropTargets(Point dropPoint)
		{
			Rectangle[] targets = base.GetDropTargets(dropPoint);
			List<Rectangle> list = new List<Rectangle>();

			int height = Bounds.Y + Bounds.Height / 2;
			int size = ( _connectorLength + 20 );
			if ( ContainedDesigners.Count == 0 ) {
				list.Add(new Rectangle(
					new Point(WorkflowHelpers.GetCenter(Bounds).X - ( size / 2 ), WorkflowHelpers.GetCenter(Bounds).Y - 10),
					new Size(size, size)));
			} else {
				for ( int i = 0; i < ContainedDesigners.Count; i++ ) {
					ActivityDesigner designer = ContainedDesigners[i];
					list.Add(new Rectangle(
						new Point(designer.Bounds.X - ( _connectorLength + 10 ), WorkflowHelpers.GetCenter(Bounds).Y - 10),
						new Size(size, size)));
				}
				list.Add(new Rectangle(
					new Point(ContainedDesigners[ContainedDesigners.Count - 1].Bounds.Right - 10,
						WorkflowHelpers.GetCenter(Bounds).Y - 10),
					new Size(size, size)));
			}
			//list.Add(new Rectangle(new Point(Bounds.X + 10, Bounds.Y + 10), new Size(50, 50)));
			//foreach (Rectangle rect in targets) {
			//    list.Add(new Rectangle(
			//        new Point(Bounds.X + distance, height),
			//        new Size(rect.Width, (int)Math.Abs((decimal)rect.Height))));
			//    distance += (rect.Width);
			//}

			return list.ToArray();
		}

		/// <summary>
		/// Sets the size of the visual cues on the designers contained within the <see cref="T:System.Workflow.ComponentModel.Design.SequentialActivityDesigner"/>.
		/// </summary>
		/// <param name="e">The <see cref="T:System.Workflow.ComponentModel.Design.ActivityDesignerLayoutEventArgs"/> that contains the layout arguments.</param>
		/// <returns>
		/// The <see cref="T:System.Drawing.Size"/> that contains the new size settings for <see cref="T:System.Workflow.ComponentModel.Design.SequentialActivityDesigner"/>.
		/// </returns>
		protected override Size OnLayoutSize(ActivityDesignerLayoutEventArgs e)
		{
			Size _size = base.OnLayoutSize(e);

			ArrangeContainedDesigners();

			int height = 0;
			int width = 0;

			foreach ( ActivityDesigner designer in ContainedDesigners ) {
				width += designer.Bounds.Width;

				if ( designer.Bounds.Height > height ) {
					height = designer.Bounds.Height;
				}
			}

			width += 30 * ContainedDesigners.Count;
			height += 20;// +TitleHeight;

			_size = new Size(width + _connectorLength, height);
			return _size;
		}

		protected void ArrangeContainedDesigners()
		{
			int distance = 0;
			foreach ( ActivityDesigner designer in ContainedDesigners ) {
				int x = Bounds.X + distance + _connectorLength;
				int y = Bounds.Y + Bounds.Height / 2 - ( designer.Bounds.Height / 2 );
				designer.Location = new Point(x, y);

				distance += ( designer.Bounds.Width ) + _connectorLength;
			}
		}

		protected virtual LineAnchor AlternateEndLineAnchor
		{
			get { return LineAnchor.ArrowAnchor; }
		}

		protected virtual LineAnchor EndLineAnchor
		{
			get { return LineAnchor.None; }
		}

		protected virtual bool ShowFirstDropIndicator
		{
			get { return true; }
		}

		/// <summary>
		/// Moves the specified activities from one designer displayed in the <see cref="T:System.Workflow.ComponentModel.Design.StructuredCompositeActivityDesigner"/> to another.
		/// </summary>
		/// <param name="moveLocation">The <see cref="T:System.Workflow.ComponentModel.Design.HitTestInfo"/> that contains the location on the workflow design surface to move the activities.</param>
		/// <param name="activitiesToMove">The <see cref="T:System.Workflow.ComponentModel.Activity"/> read-only collection to move.</param>
		public override void MoveActivities(HitTestInfo moveLocation, ReadOnlyCollection<Activity> activitiesToMove)
		{
			if ( activitiesToMove.Count == 1 && activitiesToMove[0] is HorizontalSequenceActivity ) {
				List<Activity> list = new List<Activity>();
				list.AddRange(( (HorizontalSequenceActivity)activitiesToMove[0] ).Activities);
				base.MoveActivities(moveLocation, new ReadOnlyCollection<Activity>(list));
				list.Clear();
				base.RemoveActivities(activitiesToMove);
				Invalidate();
				PerformLayout();
			} else {
				base.MoveActivities(moveLocation, activitiesToMove);
			}
		}

		/// <summary>
		/// Performs layout tasks to position visual cues and child designers on the <see cref="T:System.Workflow.ComponentModel.Design.SequentialActivityDesigner"/>.
		/// </summary>
		/// <param name="e">The <see cref="T:System.Workflow.ComponentModel.Design.ActivityDesignerLayoutEventArgs"/> that contains the layout arguments.</param>
		/// <exception cref="T:System.ArgumentNullException">
		/// 	<paramref name="e"/> contains a null reference (Nothing in Visual Basic).</exception>
		protected override void OnLayoutPosition(ActivityDesignerLayoutEventArgs e)
		{
			base.OnLayoutPosition(e);

			// arrange activities
			ArrangeContainedDesigners();

		}

		protected override ReadOnlyCollection<Point> GetInnerConnections(DesignerEdges edges)
		{
			_innerConnections.Clear();

			_innerConnections.Add(new Point(Bounds.X, Bounds.Y + Bounds.Height / 2));
			foreach ( ActivityDesigner designer in ContainedDesigners ) {
				if ( ( edges & DesignerEdges.Left ) == DesignerEdges.Left )
					_innerConnections.Add(new Point(designer.Bounds.Left, designer.Bounds.Y + designer.Bounds.Height / 2));
				if ( ( edges & DesignerEdges.Right ) == DesignerEdges.Right )
					_innerConnections.Add(new Point(designer.Bounds.Right, designer.Bounds.Y + designer.Bounds.Height / 2));
				if ( ( edges & DesignerEdges.Top ) == DesignerEdges.Top )
					_innerConnections.Add(new Point(designer.Bounds.X + designer.Bounds.Width / 2, designer.Bounds.Top));
				if ( ( edges & DesignerEdges.Bottom ) == DesignerEdges.Bottom )
					_innerConnections.Add(new Point(designer.Bounds.X + designer.Bounds.Width / 2, designer.Bounds.Bottom));
			}
			_innerConnections.Add(new Point(Bounds.X + Bounds.Width, Bounds.Y + Bounds.Height / 2));

			ReadOnlyCollection<Point> roc = new ReadOnlyCollection<Point>(_innerConnections);
			return roc;
		}

		public override ReadOnlyCollection<ConnectionPoint> GetConnectionPoints(DesignerEdges edges)
		{
			return base.GetConnectionPoints(edges);
		}

		protected override ReadOnlyCollection<Point> GetConnections(DesignerEdges edges)
		{
			return base.GetConnections(edges);
		}

		public override bool CanInsertActivities(HitTestInfo insertLocation, ReadOnlyCollection<Activity> activitiesToInsert)
		{
			if ( activitiesToInsert.Count == 1 ) {
				Activity act = activitiesToInsert[0];
				if ( ParentDesigner is JumpSplitGroupDesigner ) {
					if ( act is JumpSplitActivity ) return true;
					else return false;
				} else if ( act is HorizontalSequenceActivity ) {
					if ( act.Parent is HorizontalWorkflowActivity ) return true;
					else if ( act is JumpSplitGroupActivity ) return true;
					else return false;
				} else if ( act is NewLineActivity ) {
					if ( ParentDesigner is HorizontalWorkflowDesigner ) return true;
					else return false;
				} else if ( act is HorizontalEventHandlingScope ) {
					return true;
				}
			}
			return base.CanInsertActivities(insertLocation, activitiesToInsert);
		}

		protected override void OnConnected(ConnectionPoint source, ConnectionPoint target)
		{
			ConnectionPoint s = new ConnectionPoint(source.AssociatedDesigner, DesignerEdges.Right, source.ConnectionIndex);
			ConnectionPoint t = new ConnectionPoint(target.AssociatedDesigner, DesignerEdges.Left, source.ConnectionIndex);
			//source.ConnectionEdge = DesignerEdges.Left;
			//source.ConnectionEdge = DesignerEdges.Right;
			base.OnConnected(s, t);
		}

		protected override void OnContainedActivityChanged(ActivityChangedEventArgs e)
		{
			base.OnContainedActivityChanged(e);
		}

		protected override void OnDragLeave()
		{
			base.OnDragLeave();
			_isDragging = false;
			Invalidate();
		}

		protected override void OnMouseDragBegin(Point initialDragPoint, MouseEventArgs e)
		{
			HorizontalWorkflowDesigner root = WorkflowHelpers.GetRootDesigner(this) as HorizontalWorkflowDesigner;
			root.DraggedActivity = this.Activity;
			base.OnMouseDragBegin(initialDragPoint, e);
		}

		protected override void OnMouseDragEnd()
		{
			base.OnMouseDragEnd();
		}

		protected override void OnDragOver(ActivityDragEventArgs e)
		{
			base.OnDragOver(e);
			_isDragging = true;
			_dragPosition = new Point(e.X, e.Y);

			Invalidate();
		}

		protected override void OnDragDrop(ActivityDragEventArgs e)
		{
			base.OnDragDrop(e);
			_isDragging = false;
			Invalidate();
		}

		protected override Rectangle ExpandButtonRectangle
		{
			get
			{
				return new Rectangle();
			}
		}

		protected override Rectangle ImageRectangle
		{
			get
			{
				return new Rectangle();
			}
		}

		protected override ActivityDesignerGlyphCollection Glyphs
		{
			get
			{
				//this removes the green + from the glyphs!
				ActivityDesignerGlyphCollection glyphs = new ActivityDesignerGlyphCollection();
				foreach ( DesignerGlyph glyph in base.Glyphs ) {
					if ( glyph.GetType().FullName ==
						"System.Workflow.ComponentModel.Design.ConnectorDragDropGlyph" )
						continue;
					glyphs.Add(glyph);
				}
				return glyphs;
			}
		}

		public override Size MinimumSize
		{
			get { return _minimumSize; }
		}
	}

	public class HorizontalSequenceActivityValidator : ActivityValidator
	{
		public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
		{
			return new ValidationErrorCollection();
		}
	}

	public class HorizontalSequenceTheme : ActivityDesignerTheme
	{
		public HorizontalSequenceTheme(WorkflowTheme theme)
			: base(theme)
		{
		}
	}
}
